package com.lagou.homework.config;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

public class PropertiesConfiguration {

    private static Properties properties;

    public static String getProperties(String key) {
        if (properties == null) {
            synchronized ("wait") {
                if (properties == null) {
                    properties = new Properties();
                    InputStream stream = Thread.currentThread().getContextClassLoader()
                            .getResourceAsStream("local.properties");
                    try {
                        properties.load(stream);
                    } catch (IOException e) {
                        e.printStackTrace();
                    }
                }
            }
        }
        return properties.get(key).toString();
    }
}
